package com.nbgs.demo.service.Impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nbgs.demo.controller.info.BillConsumptionInfo;
import com.nbgs.demo.controller.info.ConsumptionInfo;
import com.nbgs.demo.controller.info.WaterBillInfo;
import com.nbgs.demo.dao.LikeMapper;
import com.nbgs.demo.dao.UserMapper;
import com.nbgs.demo.model.Complain;
import com.nbgs.demo.model.PaymentRecords;
import com.nbgs.demo.model.WaterBill;
import com.nbgs.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private LikeMapper likeMapper;

    @Override
    public List<BillConsumptionInfo> findWaterBillByCardNum(int cardId, String billState1, String billState2) {
        return userMapper.findWaterBillByCardNum(cardId,billState1,billState2);
    }

    @Override
    public IPage<ConsumptionInfo> findWaterMessageByCardId(Page<ConsumptionInfo> page, String time,int cardId) {
        return likeMapper.findWaterMessageByCardId(page, time,cardId);
    }

    @Override
    public IPage<PaymentRecords> findPaymentRecordsByCardId(Page<PaymentRecords> page, int cardId) {
        return likeMapper.findPaymentRecordsByCardId(page, cardId);
    }

    @Override
    public int findCardIdByCardNum(String cardNum) {
        return userMapper.findCardIdByCardNum(cardNum);
    }

    @Override
    public void updateByBillId(int billId) {
        userMapper.updateByBillId(billId);
    }

    @Override
    public void addPaymentRecords(PaymentRecords paymentRecords) {
        userMapper.addPaymentRecords(paymentRecords);
    }

    @Override
    public void addComplain(Complain complain) {
        userMapper.addComplain(complain);
    }

    @Override
    public List<Complain> findComplainByCardId(int cardId) {
        return userMapper.findComplainByCardId(cardId);
    }
}
